/**
 * 作者: wgx
 * 日期: 2025-03-29 10:31:54
 * 备注: 餐厅美食攻略配置表
 */
package com.motu.monstercity.server.game.commondata.restaurant;
import com.motu.monstercity.protocol.Common.PBUserData;
import com.motu.monstercity.server.game.base.CommonUtils;
import com.motu.monstercity.server.game.log.LogType;
import com.motu.monstercity.server.game.logic.RewardItem;
import com.motu.monstercity.server.game.logic.RewardManager;
import com.motu.monstercity.server.game.userdata.UserInfo;
import com.motu.vertx.module.utility.toolset.Tool;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

import java.util.List;

public class RestaurantFood extends RestaurantFoodModel {
    public RestaurantFood(JsonObject obj) {
        super(obj);
    }

    // 需要的餐厅列表
    public JsonArray takeNeedRoomArray() {
        return CommonUtils.strToJsonArray(getRestaurantType());// 需要解锁的餐厅列表
    }

    // 有概率获得特殊的额外奖励
    public String sendExtraReward(PBUserData.Builder pbUserData, UserInfo userInfo) {
        String rewardStr = "";
        if (getRewardWeight() > 0 && !Tool.isEmpty(getReward())) {
            int random = Tool.getIntRandom(10000);
            if (random <= getRewardWeight()) {
                rewardStr = getReward();// 奖励
                RewardManager.addReward(userInfo, CommonUtils.takeReawrdItemFromStr(getReward()), pbUserData, LogType.RESTAURANT_GUEST_RECEPTION);
            }
        }
        return rewardStr;
    }
}
